#include <cstdio>
#include <cstring>
 
int main() {
    int t,k;
    char s1[100], s2[100];
    scanf("%d", &t);
    while (t--) {
        scanf("%s %s", s1, s2);
		printf("Output:\n");
         k = strlen(s1) - strlen(s2);
        if (k > 0)
            printf("%s is longer than %s\n", s1, s2);
        else
            printf("%s %s %s\n", s1, 0 == k ? "is equal long to" : "is shorter than", s2);
    }
    return 0;
} 

